import instance from "@/request/request";

// 获取验证码请求     返回的是 promise对象    ()=>{}
export const getCode = () => instance.get("/captcha")

// 登录请求   {}
export const login = (formData) => instance.post("/user/login", formData)
//获取个人资料信息
export const getUserInfor = () => instance.get("/user/userinfor")

//编辑个人资料的信息
export const updateUserInfor = (userinfor) => instance.put("/user/updateinfor", userinfor)

//密码修改
export const updatePassword = (updatepassword) => instance.put("/user/updatepassword", updatepassword)
//用户管理查询
export const getUserList = (formed) => instance.get("/user/list", {params: formed})

//用户状态的改变
export const updateState=(id,state)=> instance.get("/user/updatestate/"+id,{params:{
    state:state
    }})

//获取部门信息
export const getDeptInfor=()=>instance.get("/dept/list")
//获取角色信息
export  const getRoleInfor=()=>instance.get("/role/list")
//更新用户信息
export const updateUser=(form)=>instance.post("/user/updateuser",form)
//添加用户信息
export const addUser=(form)=>instance.post("/user/adduser",form)

//删除用户信息
export const deleteUser=(ids)=>instance.delete("/user/delete",{data:ids})

//查询角色信息
export  const roleList=(roleform)=>instance.get("/role/rolelist",{params:roleform})
export  const addOrUpdateRoleApi=(roleform)=>instance.post("/role/update",roleform)
//分配权限的功能
export  const addPermisson=(form)=>instance.post("/role/addPermission",form)

//添加菜单信息
export const addPermissionApi=(form)=>instance.post("/permission/addorupdate",form)

//查询单一的的菜单
export const getonePermission=(id)=>instance.get("/permission/getone/"+id)

//删除单一的菜单
export const deleteOne=(id)=>instance.delete("/permission/delete/"+id)
//搜索
export const search=(titleName)=>instance.get("/permission/search?titleName="+titleName)

//批量导入学生信息
export const batchStudentApi = (formData)=> instance.post("/student/batchAdd",formData)
//导出学生excel表格 exportStudentExcel
export const exportStudentExcelApi = (excelData)=> instance.get("/student/excel",{params:excelData,responseType:"arraybuffer"})

//上传模版
export const uploadtemplate = (file)=> instance.post("/template/upload",file)

//下载模版
export const downtemplate = (name)=> instance.get("/template/down",{params:{
    uuidname:name
    },responseType:"arraybuffer"})

